{% extends "menu.html" %}
{% block content %}

        <!-- page content -->
        <div class="right_col" role="main">
          <div class="">
            <div class="page-title">



            </div>
            <div class="clearfix"></div>
            <div class="row">
              <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_panel">
                  <div class="x_title">
                    <h2>{{ project_name }}项目操作</h2>

                    <div class="clearfix"></div>
                  </div>
                  <div class="x_content">
                    <br />
                    <style>
                      /*自己调整宽度*/
                      .tab-wraped > li ul {
                        width: 140px;
                      }
                      .tab-wraped > li ul label {
                        width: 50px!important;
                      }
                    </style>
                    <ul class="sui-nav nav-tabs tab-wraped">
                      <li class="active">
                          <a href="#index1" data-toggle="tab">
                          <h3>模块化维护</h3></a></li>

                      <li><a href="#index3" data-toggle="tab">
                          <h3>程序更新</h3></a></li>
                      <li><a href="#index4" data-toggle="tab">
                          <h3>cdn更新</h3></a></li>
                      <li><a href="#index2" data-toggle="tab">
                          <h3>自定义维护</h3></a></li>


                    </ul>
                    <div class="tab-content tab-wraped">
                      <div id="index1" class="tab-pane active">
                          <form id="demo-form2" data-parsley-validate class="form-horizontal form-label-left" method="post">
                        {% csrf_token %}
                              <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">功能<span class="required">*</span>
                                </label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    <input type="text" id="first-name" required="required" class="form-control col-md-7 col-xs-12" name="fun_num" value="1" readonly>
                                </div>
                              </div>
                              <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">模块<span class="required">*</span>
                                </label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    <select size="10" name="cmd" style="height: 100%;width: 60%">
                                        {% for cmd in project_cmd %}
                                        <option value="{{ cmd.s_cmd__id }} ">{{ cmd.s_cmd__cmd_command }}</option>
                                        {% endfor %}
                                    </select>
                                </div>
                              </div>


                              <div class="form-group">
                                <div class="col-md-6 col-sm-6 col-xs-12 col-md-offset-3">
                                  <button class="btn btn-primary" type="button">Cancel</button>
                                  <button class="btn btn-primary" type="reset">Reset</button>
                                  <button type="submit" class="btn btn-success">Submit</button>
                                </div>
                              </div>
                          </form>
                          {{ exec_result|linebreaksbr }}
                      </div>
                      <div id="index2" class="tab-pane">
                        <form id="demo-form2" data-parsley-validate class="form-horizontal form-label-left" method="post">
                        {% csrf_token %}
                            <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">功能<span class="required">*</span>
                                </label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    <input type="text" id="first-name" required="required" class="form-control col-md-7 col-xs-12" name="fun_num" value="2" readonly>
                                </div>
                              </div>
                              <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">命令<span class="required">*</span>
                                </label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    <input type="text" id="first-name" required="required" class="form-control col-md-7 col-xs-12" name="cmd_command">
                                </div>
                              </div>
                              <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">类型<span class="required">*</span>
                                </label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    cmd.run:<input type="radio" name="cmd" value="1" checked>
                                    state.sls:<input type="radio" name="cmd" value="2">
                                    其他:<input type="radio" name="cmd" value="3"><br>
                                    #其他类型，可以执行任何命令
                                </div>
                              </div>
                              <div class="form-group">
                                <div class="col-md-6 col-sm-6 col-xs-12 col-md-offset-3">
                                  <button class="btn btn-primary" type="button">Cancel</button>
                                  <button class="btn btn-primary" type="reset">Reset</button>
                                  <button type="submit" class="btn btn-success">Submit</button>
                                </div>
                              </div>
                          </form>
                          {{ exec_result2|linebreaksbr }}
                      </div>
                    <div id="index3" class="tab-pane">
                        <form id="demo-form2" data-parsley-validate class="form-horizontal form-label-left" method="post">
                        {% csrf_token %}
                            <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">功能<span class="required">*</span>
                                </label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    <input type="text" id="first-name" required="required" class="form-control col-md-7 col-xs-12" name="fun_num" value="3" readonly>
                                </div>
                              </div>
                              <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">更新文件<span class="required">*</span>
                                </label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    <input type="text" id="first-name" required="required" class="form-control col-md-7 col-xs-12" name="file_update">
                                </div>
                              </div>
                            <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">更新文件MD5<span class="required">*</span>
                                </label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    <input type="text" id="first-name" required="required" class="form-control col-md-7 col-xs-12" name="file_md5">
                                </div>
                              </div>
                              <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">模块<span class="required">*</span>
                                </label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    <select size="10" name="cmd" style="height: 100%;width: 60%">
                                        {% for cmd in cmd_list_script %}
                                        <option value="{{ cmd.s_cmd__cmd_command  }} ">{{ cmd.s_cmd__cmd_command }}</option>
                                        {% endfor %}
                                    </select>
                                <p>该模块的执行主要是通过传递两个参数，通过客户端脚本进行获取并执行,如 sh /opt/shell/shdgr_admin $a $b,$a 为程序跟新文件的下载地址，$b 为程序提供的md5值
                                    最终执行方式是salt '项目名*' cmd.run "sh /opt/shell/shdgr_admin $a $b"
                                </p>

                                </div>

                              </div>

                              <div class="form-group">
                                <div class="col-md-6 col-sm-6 col-xs-12 col-md-offset-3">
                                  <button class="btn btn-primary" type="button">Cancel</button>
                                  <button class="btn btn-primary" type="reset">Reset</button>
                                  <button type="submit" class="btn btn-success">Submit</button>
                                </div>

                              </div>

                          </form>
                          {{ exec_result3|linebreaksbr }}
                      </div>
                    <div id="index4" class="tab-pane">
                        <form id="demo-form2" data-parsley-validate class="form-horizontal form-label-left" method="post">
                        {% csrf_token %}
                            <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">功能<span class="required">*</span>
                                </label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    <input type="text" id="first-name" required="required" class="form-control col-md-7 col-xs-12" name="fun_num" value="4" readonly>
                                </div>
                              </div>
                              <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">更新文件<span class="required">*</span>
                                </label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    <input type="text" id="first-name" required="required" class="form-control col-md-7 col-xs-12" name="file_update">
                                </div>
                              </div>
                            <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">更新文件MD5<span class="required">*</span>
                                </label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    <input type="text" id="first-name" required="required" class="form-control col-md-7 col-xs-12" name="file_md5">
                                </div>
                              </div>
                            <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">模块<span class="required">*</span>
                                </label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    <select size="10" name="cmd" style="height: 100%;width: 60%">
                                        {% for cmd in cmd_list_scripts %}
                                        <option value="{{ cmd.s_cmd__cmd_command  }} ">{{ cmd.s_cmd__cmd_command }}</option>
                                        {% endfor %}
                                    </select>
                                <p>该模块的执行主要是通过传递两个参数，通过平台自身执行如 sh /opt/shell/cdn.sh $a $b $c $d <br>
                                    $a 为程序跟新文件的下载地址<br>
                                    $b 为程序提供的md5值<br>
                                    $c 为cdn ip地址<br>
                                    $d 为cdn的目录<br>




                                </p>

                                </div>

                              </div>

                              <div class="form-group">
                                <div class="col-md-6 col-sm-6 col-xs-12 col-md-offset-3">
                                  <button class="btn btn-primary" type="button">Cancel</button>
                                  <button class="btn btn-primary" type="reset">Reset</button>
                                  <button type="submit" class="btn btn-success">Submit</button>
                                </div>
                              </div>
                          </form>
                          {{ exec_result4|linebreaksbr }}

                      </div>



                    </div>

                  </div>
                </div>
              </div>
            </div>


          </div>
        </div>
{% endblock %}